<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"><com :a="gift"></com></div>
    <template id="com">
      <fieldset>
        <legend>子组件</legend>
        g:{{a}}
      </fieldset>
    </template>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
    <script>
      Vue.component("com", {
        template: "#com",
        data(){
            return{
              
            }
        },
        props: {
          a: {
            //类型
            //检测数据的类型
            type: String,
            require: true,
            default() {
              return  111;
            },
          },
        },
      });
      const vm = new Vue({
        el: "#app",
        data: {
          gift: "vue从入门到放弃",
        },
      });
    </script>
  </body>
</html>
